package com.project.frame.common.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * desc
 * @author lw007
 * @date 2021/12/27
 */
@RestController
@RequestMapping("/v1")
@Slf4j
public class IndexController extends BaseController{

    @RequestMapping(value = "/noauth")
    public ModelAndView noauth() {
        ModelAndView mv=new ModelAndView();
        mv.setViewName("home/noauth");
        return mv;
    }

    @RequestMapping(value = "/login")
    public ModelAndView login() {
        ModelAndView mv=new ModelAndView();
        mv.setViewName("user/login");
        return mv;
    }

    @RequiresUser
    @RequestMapping(value = "/index")
    public ModelAndView index() {
        ModelAndView mv=new ModelAndView();
        mv.addObject("msg","您好，欢迎访问");
        mv.setViewName("index");
        return mv;
    }

    @RequestMapping(value = "/e404")
    public ModelAndView e404() {
        ModelAndView mv=new ModelAndView();
        mv.setViewName("home/404");
        return mv;
    }

    @RequestMapping(value = "/error")
    public ModelAndView error() {
        ModelAndView mv=new ModelAndView();
        mv.setViewName("home/error");
        return mv;
    }

    @RequiresUser
    @RequestMapping(value = "/console")
    public ModelAndView console() {
        ModelAndView mv=new ModelAndView();
        mv.setViewName("home/console");
        return mv;
    }
}
